<template>
  <login-container>
    <div @click="handleAuth">立即支付</div>
  </login-container>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { useUserStoreHook } from "@/stores/modules/user";
import type { LoginResponse } from "@/api/wechat/types";

import LoginContainer from "@/components/LoginContainer/index.vue";

const userStore = useUserStoreHook();
const userInfoAuthUrl = ref("");
console.log("------login----");
const requestId = Math.random() * 10 + "";
userStore.wechatLogin(requestId).then((data: LoginResponse) => {
  if (!data.status) {
    userInfoAuthUrl.value = data.userInfoAuthUrl;
  }
});
function handleAuth() {
  window.location.href = userInfoAuthUrl.value;
}
</script>
